package cn.imvc.app.domains;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

public enum IPayChannel {
	wxPayH5("微信公众号支付", 10), aliPayH5("支付宝网页支付", 20), unPayH5("银联网页支付", 30), wxPayApp("微信APP支付", 11), aliPayApp(
			"支付宝APP支付", 21), unPayApp("银联APP支付", 31), wxPayScanCode("微信扫码支付", 12), 
	aliPayScanCode("支付宝扫码支付", 22),pursePay("钱包支付",40);

	private String name;
	private Byte value;

	IPayChannel(String name, int value) {
		this.setName(name);
		this.setValue(value);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Byte getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = (byte)value;
	}

	public String toString() {
		return this.name;
	}

	public static IPayChannel get(int value) {
		switch (value) {
		case 10:
			return wxPayH5;
		case 11:
			return wxPayApp;
		case 12:
			return wxPayScanCode;
		case 20:
			return aliPayH5;
		case 21:
			return aliPayApp;
		case 22:
			return aliPayScanCode;
		case 30:
			return unPayH5;
		case 31:
			return unPayApp;
		case 40:
			return pursePay;
		default:
			return null;
		}
	}

	public static final Map<Byte, String> elMap = new LinkedHashMap<Byte, String>();  
	  
    static {  
        for (IPayChannel s : EnumSet.allOf(IPayChannel.class)) {  
        	elMap.put(s.getValue(), s.toString());  
        }  
    }
}
